<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">

<head>

<?php include_http_metas() ?>
<?php include_metas() ?>

<?php include_title() ?>

</head>

<body>

<div id="header">
	<?php if($sf_user->isAuthenticated()): ?>
		<div id="logged-in-panel">
			<p>
				<?php 
					$displayName = '&nbsp;';
					if($sf_user->getUsername()) {
						$displayName = $sf_user->getUsername();
					} else if($sf_user->getFullName()) {
						$displayName = $sf_user->getFullName();
					}
				?>
				Currently logged in as <?php echo link_to($displayName, 'user_profiles/show', 'class="username"')?>
			</p>
			<p><?php echo link_to('Logout', 'users/logout')?></p>
		</div>
	<?php else: ?>
		<?php include_component('users', 'login') ?>
	<?php endif; ?>
</div>



<div id="nav-wrapper">

	<div id="nav">

		<h1><?php echo link_to('FinalsClub.org', '@homepage') ?></h1>

		<ul>

			<li id="nav_home" class="<?php include_slot('homeNav') ?>">
				<?php echo link_to('Home', 'site/home') ?></li>

			<li id="nav_course-notes" class="<?php include_slot('coursesNav') ?>">
				<?php echo link_to('Courses', 'courses/index') ?></li>

			<li id="nav_book-annotations" class="<?php include_slot('libraryNav')?>">
			<?php echo link_to('Library', 'library/index') ?></li>

			<li id="nav_study-groups" class="<?php include_slot('studyGroupsNav') ?>">
				<?php echo link_to('Study Groups', 'groups/index')?></li>
<!--
			<li id="nav_online-tutoring"><a href="#">Online Tutoring</a></li>
-->
			<?php if($sf_user->isAuthenticated()): ?>
			<li id="nav_profile" class="<?php include_slot('profileNav') ?>">
				<?php echo link_to('Profile', 'user_profiles/show')?></li>
			<?php else: ?>
			<li id="nav_create-account" class="<?php include_slot('registerNav') ?>">
				<?php echo link_to('Create an Account', 'users/new') ?></li>
			<?php endif; ?>
		</ul>

	</div>

</div>
<?php if($sf_user->isAuthenticated()): ?>
<div id="wrapper">
	<div id="content">
		<div id="location-bar">
			<form class="search" action="<?php echo url_for('@search') ?>" method="post">
				<fieldset>
				<input class="input-text" name="query" type="text" value="Search Courses, Notes, Groups and People..." onfocus="query.value='';" />
				<input class="btn_submit" type="image" src="/images/btn_search.gif" alt="Search" />
				</fieldset>
			</form>
		</div>
	</div>
</div>
<?php endif; ?>

<?php echo $sf_content ?>


	<div id="footer" style="width: 960px; margin: 0 auto; clear: both;">

		<div class="blue">

			<div class="copyright">

				<h4><?php echo link_to('FinalsClub', '@homepage') ?></h4>

				<p>

					Copyright 2008.<br />

					All Rights Reserved.

				</p>

			</div>

			<div class="links">
				<ul>
					<li><?php echo link_to('Home', '@homepage') ?> | </li>
					<li><?php echo link_to('Course Notes', 'courses/index') ?> | </li>
					<li><?php echo link_to('Study Groups', 'groups/index') ?> | </li>
					<li>
						<?php if($sf_user->isAuthenticated()): ?>
							<?php echo link_to('Logout', 'users/logout')?>	
						<?php else: ?>
							<?php echo link_to('Create an Account', 'users/new') ?>
						<?php endif ?>
					</li>
				</ul>

				<?php include_component('site', 'networks')?>
			</div>

		</div>



		<ul class="centered">

			<li><?php echo link_to('Terms of Service', '@terms_of_service') ?> | </li>

			<li><a href="#">Contact</a> | </li>

			<li><?php echo link_to('About', '@about')?> | </li>
			
			<li><?php echo link_to('Privacy Policy', '@privacy_policy')?></li>

		</ul>

		<p class="centered">A service of <a href="http://www.veritutors.com">Veritas Tutors</a></p>
	
		<p class="centered">User-generated content is licensed under a<br/> <a href="http://creativecommons.org/licenses/by-nc/3.0/us/">Creative Commons Attribution<br/>Noncommercial 3.0 United States License</a></p>
		<p class="centered"><a href="http://creativecommons.org/licenses/by-nc/3.0/us/"><img src="http://i.creativecommons.org/l/by-nc/3.0/us/88x31.png" style="border-width: 0pt;" alt="Creative Commons License"/></a></p>


		<a class="veritas-logo" href="http://www.veritutors.com">Veritas Tutors</a>

	</div>
	
<script type="text/javascript">
	// The init js needs to be at the bottom of the document, within the body tag, so that any xfbml elements are already rendered by the
	// time xfbml rendering takes over.
	facebook_init();
</script>


<?php
	if (isset($_SESSION['onload_js'])):
		$onload_js = $_SESSION['onload_js'];
?>
		 <script type="text/javascript">
		  	window.onload = function() { <?php echo $onload_js ?> };
		 </script>
<?php
		unset($_SESSION['onload_js']);
	endif;
?>


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = '';
if(location.hostname.match('www')) pageTracker = _gat._getTracker("UA-8665082-1");
else if(location.hostname.match('staging')) pageTracker = _gat._getTracker("UA-8665082-2");
if(pageTracker != '') pageTracker._trackPageview();
} catch(err) {}</script> 


</body>
</html>
